//
//  MASingleton.m
//  MateAdv
//
//  Created by 茶 on 2023/9/20.
//

#import "MASingleton.h"


@implementation MASingleton

#pragma mark -- Singleton
+ (instancetype)sharedInstance {
    id sharedInstance = objc_getAssociatedObject(self, @"MASharedInstance");
    if (!sharedInstance) {
        sharedInstance = [[super allocWithZone:NULL] init];
        objc_setAssociatedObject(self, @"MASharedInstance", sharedInstance, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    return sharedInstance;
}
 
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    return [self sharedInstance];
}
 
- (id)copyWithZone:(nullable NSZone *)zone {
    return [self.class sharedInstance];
}

@end
